import error from 'koa-json-error'
import Koa from 'koa'

export default function (app: Koa) {
  app.use(
    error({
      postFormat: (e, { stack, ...rest }) =>
        process.env.NODE_ENV === 'production' ? rest : { stack, ...rest },
    })
  )
}
